#ifndef DEVICE_H__
#define DEVICE_H__

#include "stdint.h"
#include "ptdef.h"
#include "stdbool.h"



#ifdef __cplusplus
extern "C" {
#endif

enum device_id_table{
    DEVIEC_ID_PIN = 1,
    DEVIEC_ID_UART,
	DEVIEC_ID_SPI_BUS_1,
	DEVIEC_ID_SPI_DEV_1,
};

int32_t pt_device_register(pt_device_t dev,
                            uint8_t     device_id,
                            int16_t flags);

int32_t pt_device_unregister(pt_device_t dev);

pt_device_t pt_device_find(uint8_t device_id);
int32_t pt_device_init(pt_device_t dev);
int32_t pt_device_open ( pt_device_t dev, uint16_t oflag );

uint32_t pt_device_read ( pt_device_t dev,
						  int32_t    pos,
						  void    *   buffer,
						  uint32_t   size );

uint32_t pt_device_write ( pt_device_t dev,
						   int32_t    pos,
						   const void * buffer,
						   uint32_t   size );

int32_t pt_device_close ( pt_device_t dev );

int32_t
pt_device_set_rx_indicate ( pt_device_t dev,
							int32_t ( *rx_ind ) ( pt_device_t dev, uint32_t size ) );
#ifdef __cplusplus
}
#endif

#endif
